package com.ijianji.module_play_video

import android.content.Context
import com.danikula.videocache.HttpProxyCacheServer
import com.dueeeke.videoplayer.ijk.IjkPlayerFactory
import com.dueeeke.videoplayer.player.VideoViewConfig
import com.dueeeke.videoplayer.player.VideoViewManager
import com.ijianji.module_play_video.utils.VideoCacheFileNameGenerator

/**
 * 视频播放模块初始化工具类
 */
object PlayVideoModuleInitUtils {

    lateinit var proxy: HttpProxyCacheServer

    /**
     * 视频播放模块初始化
     */
    fun init(context: Context) {
        proxy = HttpProxyCacheServer.Builder(context)
                .fileNameGenerator(VideoCacheFileNameGenerator())
                .build()
        VideoViewManager.setConfig(VideoViewConfig.newBuilder() //使用使用IjkPlayer解码
                .setPlayerFactory(IjkPlayerFactory.create())
                .build())
    }


}